Skip to content

Add equalent np.convolve (just full mode)#7

Merged
Oceania2018 merged 1 commit intoSciSharp:masterfrom
dotChris90:master
Oct 17, 2018
Merged

Add equalent np.convolve (just full mode)#7
Oceania2018 merged 1 commit intoSciSharp:masterfrom
dotChris90:master

Conversation

@dotChris90
Copy link
Copy Markdown
Member

@Oceania2018
Copy link
Copy Markdown
Member

Hi @dotChris90 , the np.convolve looks great, could you please add the convolve to the Implemented APIs list in the README?

@Oceania2018
Copy link
Copy Markdown
Member

Keep this open due to same and valid mode is not finished yet.

@Oceania2018 Oceania2018 merged commit 5d9b3c7 into SciSharp:master Oct 17, 2018
Nucs added a commit that referenced this pull request Apr 23, 2026
Implements fixes detailed in docs/NPYITER_FIXES_REQUIRED.md to improve
NumPy compatibility of the NpyIter implementation.

Fix #1: Coalescing Always Runs
- Changed NpyIterRef.Initialize() to always coalesce axes after
  construction unless MULTI_INDEX flag is set
- Matches NumPy's nditer_constr.c line 395-396 behavior

Fix #2: Inner Stride Cache
- Added InnerStrides[MaxOperands] array to NpyIterState
- Added UpdateInnerStrides() method to gather inner strides
- GetInnerStrideArray() now returns contiguous array matching
  NumPy's NpyIter_GetInnerStrideArray() format

Fix #3: op_axes Parameter Implementation
- Added ApplyOpAxes() method to support axis remapping
- Supports -1 entries for broadcast/reduction axes
- Enables reduction operations via custom axis mapping

Fix #4: Multi-Index Support
- Added GetMultiIndex(Span<long>) for coordinate retrieval
- Added GotoMultiIndex(ReadOnlySpan<long>) for coordinate jumping
- Added HasMultiIndex property
- HASMULTIINDEX flag tracked during construction

Fix #5: Ranged Iteration
- Added ResetToIterIndexRange(start, end) for parallel chunking
- Added IterStart, IterEnd, and IsRanged properties
- RANGE flag tracks ranged iteration mode

Fix #6: Buffer Copy Type Dispatch
- Added non-generic CopyToBuffer/CopyFromBuffer overloads
- Runtime dtype dispatch for all 12 NumSharp types
- Enables dtype-agnostic iteration code

Fix #7: Flag Bit Positions Documented
- Added documentation explaining NumSharp's flag bit layout
- Legacy compatibility flags use bits 0-7
- NumPy-equivalent flags use bits 8-15
- Semantic meaning matches NumPy, positions differ

Fix #8: MaxDims Increased to 64
- Changed MaxDims from 32 to 64 to match NPY_MAXDIMS
- Supports high-dimensional array iteration

Test coverage:
- 13 new tests for coalescing, multi-index, ranged iteration,
  inner strides, and MaxDims validation
- All 5666 non-OpenBugs tests pass

Note: Full axis reordering before coalescing (for complete 1D
coalescing of contiguous arrays) not yet implemented. Current
implementation coalesces adjacent compatible axes only.
Nucs added a commit that referenced this pull request Apr 23, 2026
Explicit the hierarchy — Tier A/B/C were always sub-tiers of Layer 3
(the baked-ufunc layer). Numbering them `3A/3B/3C` makes the
relationship visible at a glance:

  Layer 1  —  ForEach (delegate)
  Layer 2  —  ExecuteGeneric (struct-generic)
  Layer 3  —  ExecuteBinary / Unary / ...  (baked)
  Tier 3A  —  ExecuteRawIL              (sub-tier: custom IL)
  Tier 3B  —  ExecuteElementWise        (sub-tier: templated)
  Tier 3C  —  ExecuteExpression / Call  (sub-tier: DSL)

100 references touched across 6 files:
  docs/website-src/docs/NDIter.md  — prose, TOC, anchor links, worked-
                                    example heading anchors (#6, #7, #8)
  src/NumSharp.Core/Backends/Iterators/NpyExpr.cs       — header comment
  src/NumSharp.Core/Backends/Iterators/NpyIter.Execution.Custom.cs
    — file header, region comments for each tier entry point
  src/NumSharp.Core/Backends/Kernels/ILKernelGenerator.InnerLoop.cs
    — factory method docstrings
  test/NumSharp.UnitTest/Backends/Iterators/NpyIterCustomOpTests.cs
    — class docstring, region comments, 10 test method names
    (TierA_* → Tier3A_*, TierB_* → Tier3B_*, TierC_* → Tier3C_*)
  test/NumSharp.UnitTest/Backends/Iterators/NpyIterCustomOpEdgeCaseTests.cs
    — region comments, 2 test method names (Validate_TierA_* →
    Validate_Tier3A_*)

No behavior changes. 264/264 NpyExpr + custom-op tests pass on net8 +
net10. Full suite still green (0 regressions).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants